<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
 <div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>
	<div id="mainownservice">
	<h3><?php echo JText::_('Receiver account'); ?></h3>
	<hr />
	<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">
	<div class="cSubmenu">
		<ul class="submenu">
			<li><a href="#" onclick="javascript: submitbutton('detail')"><?php echo JText::_('OWNSERVICE_PERSONAL_DETAIL'); ?></a></li>
			<li><a href="#" onclick="javascript: submitbutton('account')" class="active"><?php echo JText::_('OWNSERVICE_ACCOUNTS'); ?></a></li>
			<li><a href="#" onclick="javascript: submitbutton('transfer')"><?php echo JText::_('OWNSERVICE_TRANSFER_HISTORYS'); ?></a></li>
		</ul>
	</div>
	<?php if($this->access->canAdd): ?>
	<div id="toolbar">
		<a class="toolbar" onclick="javascript: submitbutton('acadd')" href="#">
			<span title="<?php echo JText::_('OWNSERVICE_NEW_ACCOUNT'); ?>" class="icon-32-new"></span>
			<?php echo JText::_('OWNSERVICE_NEW_ACCOUNT'); ?>
		</a>
	</div>
	<div class="clear"> </div>
	<?php endif; ?>
	<table class="adminlist" width="100%" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" border="1" rules="rows">
		<tr>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_ACCOUNT_NO'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_ACCOUNT_NAME'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_ACCOUNT_TYPE'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_BANK_NAME'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_BRANCH_NAME'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_DATE'); ?></td>
			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_SELECT_ACTION'); ?></td>
		</tr>
		<?php
			$dateformat  = OwnserviceHelper::getParams('date_format', '%d/%m/%Y'); 
			for($i=0,$n=count($this->rows);$i<$n;$i++): 
			$row = $this->rows[$i];
		?>
		<tbody>
		<tr>
			<td class="inner_tablelist" align="center">
				<a href="<?php echo JText::_('index.php?option=com_ownservice&controller=member&task=acdetail&id='.$row->id.'&mid='.$this->member->id); ?>">
					<?php echo OwnserviceHelper::accountFormat($row->account_no); ?>
				</a>
			</td>
			<td class="inner_tablelist"><?php echo $row->account_name; ?></td>
			<td class="inner_tablelist">
			<?php 
				if($row->account_type == 'other')
				{
					echo $row->type_other; 	
				} else {
					echo OwnserviceHelper::getAccountType($row->account_type);
				} 
			?>
			</td>
			<td class="inner_tablelist"><?php echo $row->bank_name=='other'?$row->bank_other:$row->bank_name; ?></td>
			<td class="inner_tablelist"><?php echo $row->branch_name; ?></td>
			<td class="inner_tablelist" align="center"><?php echo JHTML::_('date', $row->created, $dateformat); ?></td>
			<td class="inner_tablelist" align="center">
				<select class="inputbox" name="action" id="action" onChange="listTaskAction(<?php echo $row->id ?>,this.value);">
					<option value="" selected><?php echo JText::_('OWNSERVICE_PLEASE_SELECT'); ?></option>
					<?php if($this->access->canView): ?><option value="acdetail"><?php echo JText::_('OWNSERVICE_VIEW');?></option><?php endif; ?>
					<?php if($this->access->canEdit): ?><option value="acedit"><?php echo JText::_('OWNSERVICE_EDIT');?></option><?php endif; ?>
					<?php if($this->access->canDelete): ?><option value="acdel"><?php echo JText::_('OWNSERVICE_DELETE');?></option><?php endif; ?>
				</select>
			</td>
		</tr>
		<?php endfor; ?>
		</tbody>
	</table>
	<input type="hidden" name="id" value="" />
	<input type="hidden" name="mid" value="<?php echo $this->member->id; ?>" />
	<input type="hidden" name="option" value="com_ownservice" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />
	<input type="hidden" name="controller" value="member" />
	<input type="hidden" name="view" value="member" />
	<?php echo JHTML::_( 'form.token' ); ?>
	</form>
	</div>
</div>